/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * formDettaglioCamere.java
 *
 * Created on Dec 7, 2009, 3:22:53 PM
 */

package example;

import java.awt.event.ItemEvent;

/**
 *
 * @author keysman
 */
public class formDettaglioCamere extends our.gui.ourForm {

    /** Creates new form formDettaglioCamere */
    public formDettaglioCamere(/*String strTitle, int X, int Y, int WIDTH, int HEIGHT, */java.awt.Frame parent, boolean modal) {
        super(/*strTitle, HEIGHT, WIDTH, */parent, modal);
        initComponents();
        // Compilare le due seguenti chiamante
        //setDB_Sort_Fields(""); // Campo/i su cui è ordinato lo scroll dei records (ad. es. cognome, nome)
        setDB_Table("CAMERE");       // Tabella del DB alla quale è associata la form
        setDB_txtId_Field("id");    // Il campo del db di tipo autoinc (generalmente chiamato id) che verrà inserito in txtID (hidden)
        setRealDelete(false); // Settare a true se il record deve essere eliminato fisicamente dalla tabella
        setPrintForm(""); // Classe adibita alla stampa
        System.out.println("--->" + this.ourTextField2.SETTINGS.getIsFirstOfKeyFrame());
    }

    public void INSERT() throws java.sql.SQLException { }

    public void DELETE() throws java.sql.SQLException { }

    public void UPDATE() throws java.sql.SQLException { }

    public void GOLAST() { }

    public void GOFIRST() { }

    public void GONEXT() { }

    public void GOPREV() { }

    public void GOTO() { }

    public void GOTO(Object[] KEY) { }

    public void CALLZOOM() { }

    public Object GETFIELDSVALUE() { return null; }

    public void SETFIELDSVALUE() { }

    public boolean BEFOREWRITING(boolean bShowTheMessage) { return true; }

    public void RESET() { }

    public void ENABLE(boolean bEnable) { }

    public String USER_FOUND_KEY() { return null; }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        ourPanel1 = new our.gui.ourPanel();
        ourPanel2 = new our.gui.ourPanel();
        ourLabel1 = new our.gui.ourLabel();
        ourTextField1 = new our.gui.ourTextField();
        ourLabel2 = new our.gui.ourLabel();
        ourTextField2 = new our.gui.ourTextField();
        ourLabel3 = new our.gui.ourLabel();
        ourLabel4 = new our.gui.ourLabel();
        ourTextField3 = new our.gui.ourTextField();
        ourLabel5 = new our.gui.ourLabel();
        ourLabel6 = new our.gui.ourLabel();
        ourTextField4 = new our.gui.ourTextField();
        ourLabel7 = new our.gui.ourLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        ourTextArea1 = new our.gui.ourTextArea();
        ourPanel3 = new our.gui.ourPanel();
        ourCheckBox1 = new our.gui.ourCheckBox();
        ourLabel8 = new our.gui.ourLabel();
        ourLabel9 = new our.gui.ourLabel();
        txtDal = new our.gui.ourTextField();
        txtA = new our.gui.ourTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(null);

        ourPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        ourPanel1.setLayout(null);

        ourPanel2.setKeyFrame(true);
        ourPanel2.setOpaque(false);
        ourPanel2.setLayout(null);

        ourLabel1.setText("Numero");
        ourPanel2.add(ourLabel1);
        ourLabel1.setBounds(10, 10, 46, 20);

        ourTextField1.setCharsInputAllowed(6);
        ourTextField1.setFieldOnDB("numero");
        ourTextField1.setHelpMsg("Numero della camera");
        ourTextField1.setKeyFrameFirstField(true);
        ourTextField1.setWithStar(true);
        ourTextField1.setZoomOnClass("example.zoom.zoomDettaglioCamere");
        ourPanel2.add(ourTextField1);
        ourTextField1.setBounds(90, 10, 150, 20);

        ourPanel1.add(ourPanel2);
        ourPanel2.setBounds(0, 0, 480, 30);

        ourLabel2.setText("Tipologia");
        ourPanel1.add(ourLabel2);
        ourLabel2.setBounds(10, 40, 53, 20);

        ourTextField2.setCharsInputAllowed(5);
        ourTextField2.setFieldOnDB("tipologia");
        ourTextField2.setFieldShowIdZoomCol(2);
        ourTextField2.setFieldShowObj(ourLabel3);
        ourTextField2.setFirstFieldOutOfKeyFrame(true);
        ourTextField2.setHelpMsg("Codice tipologia camera");
        ourTextField2.setIsZoomOnZoomEnabled(true);
        ourTextField2.setWithStar(true);
        ourTextField2.setZoomOnClass("example.zoom.zoomCamere");
        ourPanel1.add(ourTextField2);
        ourTextField2.setBounds(90, 40, 95, 20);

        ourLabel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        ourPanel1.add(ourLabel3);
        ourLabel3.setBounds(210, 40, 260, 20);

        ourLabel4.setText("Piano");
        ourPanel1.add(ourLabel4);
        ourLabel4.setBounds(10, 70, 31, 20);

        ourTextField3.setCharsInputAllowed(5);
        ourTextField3.setFieldOnDB("piano");
        ourTextField3.setFieldShowIdZoomCol(2);
        ourTextField3.setFieldShowObj(ourLabel5);
        ourTextField3.setHelpMsg("Codice piano");
        ourTextField3.setIsZoomOnZoomEnabled(true);
        ourTextField3.setWithStar(true);
        ourTextField3.setZoomOnClass("example.zoom.zoomPiani");
        ourPanel1.add(ourTextField3);
        ourTextField3.setBounds(90, 70, 95, 20);

        ourLabel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        ourPanel1.add(ourLabel5);
        ourLabel5.setBounds(210, 70, 260, 20);

        ourLabel6.setText("Max. letti");
        ourPanel1.add(ourLabel6);
        ourLabel6.setBounds(10, 100, 53, 20);

        ourTextField4.setCharsInputAllowed(6);
        ourTextField4.setFieldOnDB("max_letti");
        ourTextField4.setHelpMsg("Numero massimo di letti");
        ourTextField4.setMaxTextLength(2);
        ourTextField4.setWithStar(true);
        ourPanel1.add(ourTextField4);
        ourTextField4.setBounds(90, 100, 95, 20);

        ourLabel7.setText("Note");
        ourPanel1.add(ourLabel7);
        ourLabel7.setBounds(10, 130, 27, 15);

        ourTextArea1.setColumns(20);
        ourTextArea1.setLineWrap(true);
        ourTextArea1.setRows(5);
        ourTextArea1.setFieldOnDB("note");
        ourTextArea1.setMaxLen(200);
        jScrollPane1.setViewportView(ourTextArea1);

        ourPanel1.add(jScrollPane1);
        jScrollPane1.setBounds(90, 130, 380, 72);

        getContentPane().add(ourPanel1);
        ourPanel1.setBounds(5, 40, 480, 220);

        ourPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        ourPanel3.setLayout(null);

        ourCheckBox1.setText("Non disponibile");
        ourCheckBox1.setFieldOnDB("non_disponibile");
        ourCheckBox1.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ourCheckBox1ItemStateChanged(evt);
            }
        });
        ourCheckBox1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                ourCheckBox1PropertyChange(evt);
            }
        });
        ourPanel3.add(ourCheckBox1);
        ourCheckBox1.setBounds(10, 10, 120, 20);

        ourLabel8.setText("dal");
        ourPanel3.add(ourLabel8);
        ourLabel8.setBounds(140, 10, 30, 20);

        ourLabel9.setText("al");
        ourPanel3.add(ourLabel9);
        ourLabel9.setBounds(260, 10, 10, 20);

        txtDal.setCharsInputAllowed(1);
        txtDal.setFieldOnDB("da");
        txtDal.setMaxTextLength(6);
        ourPanel3.add(txtDal);
        txtDal.setBounds(170, 10, 80, 20);

        txtA.setCharsInputAllowed(1);
        txtA.setFieldOnDB("a");
        txtA.setMaxTextLength(6);
        ourPanel3.add(txtA);
        txtA.setBounds(280, 10, 80, 20);

        getContentPane().add(ourPanel3);
        ourPanel3.setBounds(5, 270, 480, 40);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void ourCheckBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ourCheckBox1ItemStateChanged
        // TODO add your handling code here:
        if(getUserMode()==our.gui.ourForm.MODE_VIS) return;
        if(evt.getStateChange()==ItemEvent.DESELECTED)
        {
            txtDal.setEnabled(false);
            txtA.setEnabled(false);
        } else {
            txtDal.setEnabled(true);
            txtA.setEnabled(true);
        }
    }//GEN-LAST:event_ourCheckBox1ItemStateChanged

    private void ourCheckBox1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_ourCheckBox1PropertyChange
        // TODO add your handling code here:
        System.out.println(evt);
        if(ourCheckBox1.isEnabled())
        {
            txtDal.setEnabled(ourCheckBox1.isSelected());
            txtA.setEnabled(ourCheckBox1.isSelected());
        }
    }//GEN-LAST:event_ourCheckBox1PropertyChange

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private our.gui.ourCheckBox ourCheckBox1;
    private our.gui.ourLabel ourLabel1;
    private our.gui.ourLabel ourLabel2;
    private our.gui.ourLabel ourLabel3;
    private our.gui.ourLabel ourLabel4;
    private our.gui.ourLabel ourLabel5;
    private our.gui.ourLabel ourLabel6;
    private our.gui.ourLabel ourLabel7;
    private our.gui.ourLabel ourLabel8;
    private our.gui.ourLabel ourLabel9;
    private our.gui.ourPanel ourPanel1;
    private our.gui.ourPanel ourPanel2;
    private our.gui.ourPanel ourPanel3;
    private our.gui.ourTextArea ourTextArea1;
    private our.gui.ourTextField ourTextField1;
    private our.gui.ourTextField ourTextField2;
    private our.gui.ourTextField ourTextField3;
    private our.gui.ourTextField ourTextField4;
    private our.gui.ourTextField txtA;
    private our.gui.ourTextField txtDal;
    // End of variables declaration//GEN-END:variables

}
